<su-input type="text" label="<%= t 'activerecord.attributes.user.account' %>" autofocus required :validators="{minlength: 2}"
          name="user[account]" value="<%= user.account if user.present? %>" placeholder="登录账号">
  <span slot="help">至少<code>2个字符</code></span>
</su-input>
<su-input type="password" label="<%= t "activerecord.attributes.user.password" %>" <%= 'required' if action_name != 'edit' && action_name != 'update' %>  :validators="{minlength: 8}"
          name="user[password]">
  <p slot="help">密码最少为<code>8位字符</code></p>
  <%= '<p slot="help">修改时, 留空则不会修改密码.</p>'.html_safe if (action_name == 'edit' || action_name == 'update') %>
</su-input>
<su-input type="text" label="<%= t "activerecord.attributes.user.name" %>" :validators="{minlength: 2}"
          name="user[name]" value="<%= user.name if user.present? %>" placeholder="真实姓名">
</su-input>
<su-input type="tel" label="<%= t "activerecord.attributes.user.phone" %>" :validators="['phone']" placeholder="手机号码"
          name="user[phone]" value="<%= user.phone if user.present? %>">
  <span slot="help"><code>11个字符</code>的手机号码,可当做账号登录</span>
</su-input>

<su-select label="<%= t "activerecord.attributes.user.roles" %>" multiple name="user[roles][]" :value="<%= user.roles.ids if user.present? %>">
  <% Role.all.each do |role| %>
      <option value="<%= role.id %>"><%= role.name %></option>
  <% end %>
</su-select>
<su-input type="text" label="<%= t "activerecord.attributes.user.email" %>" :validators="['email']"
          name="user[email]" value="<%= user.email if user.present? %>">
  <span slot="help">可以当做账号登陆</span>
</su-input>